// This page perform the check out procees we fetch the values of the bid and send the user to paypal site
// Created : jun 17,06
// Author : Rupinder Saini

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteManager;
using System.Data.SqlClient;

public partial class Doctor_PaypalCheckout : System.Web.UI.Page
{
    public string bid_id ="";
    public string bid_type = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        // get all the bid detals here.
        Manager mgr = new Manager(true,"ConnectionString");

        try
        {
            if (Request.QueryString["bidingtype"] != null)
            {
                SqlParameter[] sqlParam = new SqlParameter[1];
                sqlParam[0] = new SqlParameter("@dr_id", SqlDbType.Int);
                sqlParam[0].Value = Session["userID"];

                // fetch the bid details
                DataSet ds_drbid = mgr.ExecuteQuery("getbiddetailsbybidid", sqlParam, "tbl_bid");
                //invoice.Value = ds_drbid.Tables[0].Rows[0]["id"].ToString();
                bid_id = ds_drbid.Tables[0].Rows[0]["id"].ToString(); 
                //invoice.Value;

                if (Request.QueryString["bidingtype"].ToString() == "1")
                {
                    bid_type = "Y";
                    
                    //if (ds_drbid.Tables[0].Rows.Count > 0)
                    //{
                        
                    //    //amount.Value = ds_drbid.Tables[0].Rows[0]["Trx_Amount"].ToString();
                    //}
                    //notify_url.Value = Session["strHttp"] + "doctor/updatecheckout.aspx";
                    //cancel_return.Value = Session["strHttp"] + "doctor/CreditCard.aspx?id=0";
                }
                else if (Request.QueryString["bidingtype"].ToString() == "2")
                {
                    bid_type = "M";
                    //SqlParameter[] sqlParam = new SqlParameter[1];
                    //sqlParam[0] = new SqlParameter("@dr_id", SqlDbType.Int);
                    //sqlParam[0].Value = Session["userID"];
                    //// fetch the bid details
                    //DataSet ds_drbid = mgr.ExecuteQuery("getbiddetailsbybidid", sqlParam, "tbl_bid");
                    //if (ds_drbid.Tables[0].Rows.Count > 0)
                    //{
                    //    invoice.Value = ds_drbid.Tables[0].Rows[0]["id"].ToString();
                    //    bid_id = invoice.Value;
                    //}
                }
                else if (Request.QueryString["bidingtype"].ToString() == "3")
                {
                    bid_type = "B";
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
     }
}
